package com.fqgj.sentry.policy.enums;

/**
 * Created with IntelliJ IDEA.
 * User: yujianfu (mr.vencnet@gmail.com)
 * Date: 2017/7/19
 * Time: 下午5:21
 */
public enum RuleConditionTypeEnum {
    first_match(1, "首次匹配"),
    bad_match(2, "最坏匹配"),
    weight_match(3, "权重匹配"),
    score(4, "评分");

    private int type;
    private String desc;

    RuleConditionTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public RuleConditionTypeEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public RuleConditionTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }


    public static RuleConditionTypeEnum getEnumByType(int type) {
        RuleConditionTypeEnum ruleConditionTypeEnum = null;
        for (RuleConditionTypeEnum e : RuleConditionTypeEnum.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return ruleConditionTypeEnum;
    }
}
